import React from 'react'

import {E8FormCloud} from 'weaPortalTheme';
import Form from './form'
import {inject, observer} from "mobx-react";

export default class ContainerViewExtend extends React.Component{

    render(){
        const {data,tabId,componentType,isSetting} = this.props
        const {items}  = data
        let content = null
        let item
        if(items.length > 0 && items.find((element)=>(element.id == tabId))){
            for(let i = 0 ;i < items.length ;i++){
                if(items[i].id == tabId){
                    item = items[i]
                }

            }
            // item = items.find((element)=>(element.id == tabId))
            if(componentType=="e8Form"){
                content = (
                    <Form ecId={`${this && this.props && this.props.ecId || ''}_Form@e5fjtp`} {...this.props}></Form>
                )
            }else if(componentType=="e8FormCloud"){
                const {setting} = item
                if(isSetting == true){
                    content = (
                        <E8FormCloud ecId={`${this && this.props && this.props.ecId || ''}_E8FormCloud@u69f3a`} loginInfo={setting} loginForm={setting} isNeedGetLoginInfo={true} isFormCloudSetting={true} ></E8FormCloud>
                    )
                }else{
                    content = (
                        <E8FormCloud ecId={`${this && this.props && this.props.ecId || ''}_E8FormCloud@yxda7m`}  loginInfo={setting} loginForm={setting} ></E8FormCloud>
                    )
                }

            }

        }

        return (
            <div style={{height:'100%','display':'flex','flex-flow':'column','align-items':'center'}}>
                {content}
            </div>
        )
    }
}